# Libreries
IFLAGS=-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include

# Options
ifndef EXTRA
   EXTRA="-O"
endif
COMPILER=g++
LINKER=ar

# Source Files
SOURCES:=$(wildcard *.cpp) $(wildcard *.c)
# Source or compiling files
OBJECTS=$(SOURCES:.cpp=.o) $(SOURCES:.c=.o)
LIBRARY=mokardu.a

all: clean build link

build:
	@ echo "## Compiling libraries ..."
	@ for i in $(SOURCES);do \
		$(COMPILER) $(EXTRA) $(IFLAGS) -c $$i; \
	done

link:
	@ echo "## Merging libraries ..."
	@ $(LINKER) rsc $(LIBRARY) $(OBJECTS)

clean:
	@ echo "## Cleaning libraries ..."
	@ $(RM) *.o
	@ $(RM) *.a

